package com.heima.review.controller;

import com.heima.common.dtos.ResponseResult;
import com.heima.model.comment.dtos.CommentLikeDto;
import com.heima.model.review.dtos.ReviewPageDTO;
import com.heima.review.service.AdCommentLikeService;
import com.heima.review.service.AdCommentService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "文章评论回复")
@RestController
public class ReviewRepayController {

    @Autowired
    private AdCommentLikeService likeService;
    @Autowired
    private AdCommentService commentService;

    /**
     * 文章评论回复-点赞
     */
    @PostMapping("/api/v1/comment_repay/like")
    public ResponseResult repayLike(CommentLikeDto dto){
        Integer likes = likeService.like(dto);
        return ResponseResult.ok(likes);
    }

    /**
     * 文章回复查询列表
     * @param dto
     * @return
     */
    @PostMapping("/api/v1/comment_repay/load")
    public ResponseResult load(@RequestBody ReviewPageDTO dto){
        return ResponseResult.ok(commentService.load(dto));
    }
}
